package com.cmsky.open.core.util;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;

public class RequestUtils {
	public static Integer getInt(HttpServletRequest request,String name,Integer defaultValue){
		Integer result = defaultValue;
		try {
			result = Integer.parseInt(request.getParameter(name));
		} catch (Exception e) {
		}
		return result;
	}
	public static Double getDouble(HttpServletRequest request,String name,double defaultValue){
		Double result = defaultValue;
		try {
			result = Double.parseDouble(request.getParameter(name));
		} catch (Exception e) {
		}
		return result;
	}
	public static String getString(HttpServletRequest request,String name,String defaultValue){
		String result = null;
		result = request.getParameter(name);
		if(StringUtils.isBlank(result)){
			result = defaultValue;
		}
		return result;
	}
}
